<html>
<head>
  <title>Evernote Export</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="Evernote Windows/307027 (zh-CN, DDL); Windows/10.0.0 (Win64);"/>
  <meta name="reminder-order" content="2017/5/18 20:07"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="2424"/>

<div>
<span><div><div><br/></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">网页由什么构成？</span></h3><div><br/></div><div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;"><div><font style="font-size: 12pt;"><span style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-weight: bold;">英文全名：cascading style sheets(百度百科) === cascading style sheet</span></font></div><div><span style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-weight: bold;"><font style="font-size: 12pt;">层叠样式表,WEB标准中的表现标准语言,表现标准语言在网页中主要对网页信息的显示进行控制，简单说就是如何修饰网页信息的显示样式。</font></span></div><div><span style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-weight: bold;"><font style="font-size: 12pt;">目前推荐遵循的是W3C发布的CSS3.0. </font></span></div><div><span style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-weight: bold;"><font style="font-size: 12pt;">用来表现XHTML或者XML等样式文件的计算机语言。</font></span></div><div><span style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-weight: bold;"><font style="font-size: 12pt;">1998年5月21日由w3C正式推出的css2.0</font></span></div></div><div><br/></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">CSS编写语法</span></h3><div><img src="002-CSS基础内容_files/pic1.png" type="image/png" data-filename="pic1.png"/></div><div><br/></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">样式的创建(内部样式 外部样式 内联样式)、两种引入外部样式表的区别</span></h3><div><div style="margin: 0px; padding: 0px;"><span style="line-height: 40px;">A、内部样式</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div>语法：</div><div>&lt;style type=&quot;text/css&quot;&gt;</div><div>/*css语句*/</div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="-en-paragraph:true;">&lt;/style&gt;</span></div><div><span style="font-size: 18px; color: red; line-height: 40px;">注：使用style标记创建样式时，最好将该标记写在&lt;head&gt;&lt;/head&gt;;</span></div></blockquote><div>B、外部样式 </div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div>*方法一：外部样式表的创建：</div><div>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;目标文件的路径及文件名全称&quot; /&gt;</div><div>说明：</div><div>使用link元素导入外部样式表时，需将该元素写在文档头部，即&lt;head&gt;与&lt;/head&gt;之间。</div><div>rel（relation）：用于定义文档关联，表示关联样式表；</div><div>type：定义文档类型；</div></blockquote><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div>*方法二：外部样式表的导入</div><div>&lt;style type=&quot;text/css&quot;&gt;</div><div>@import url(目标文件的路径及文件名全称);</div><div>&lt;/style&gt;</div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 18px; color: red;-en-paragraph:true;">注：@和import之间没有空格 url和小括号之间也没有空格；必须结尾以分号结束；</span></div></blockquote><div style="margin: 0px; padding: 0px;"><span style="line-height: 40px;">C、内联样式 （行间样式，行内样式，嵌入式样式）</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div style="margin: 0px; padding: 0px;"><span style="line-height: 40px;">语法：&lt;标签 style=&quot;属性：属性值;属性:属性值;&quot;&gt;&lt;/标签&gt;</span></div></blockquote></div><div><br/></div><div><br/></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">两种引入外部样式表link和import之间的区别</span></h3><div style="margin: 0px 0px 0px 30px; padding: 0px; font-size: medium; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="margin: 0px; padding: 0px;"><span style="font-size: medium; color: rgb(4, 77, 34); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">扩展知识点：link和import导入外部样式的区别：</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div style="margin: 0px; padding: 0px;"><span style="font-size: 18px; color: red; font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">差别1：本质的差别：</span><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">link属于XHTML标签，而@import完全是CSS提供的一种方式。</span></div><div><span style="font-size: 18px; color: red; font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">差别2：加载顺序的差别：</span><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">当一个页面被加载的时候（就是被浏览者浏览的时候），link引用的CSS会同时被加载，而@import引用的CSS会等到页面全部被下载完再被加载。所以有时候浏览@import加载CSS的页面时开始会没有样式（就是闪烁），网速慢的时候还挺明显。</span></div><div><span style="font-size: 18px; color: red; font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">差别3：兼容性的差别：</span><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">@import是CSS2.1提出的，所以老的浏览器不支持，@import只有在IE5以上的才能识别，而link标签无此问题。</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 18px; color: red; font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;-en-paragraph:true;">差别4：使用dom(document object model文档对象模型 )控制样式时的差别</span><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;-en-paragraph:true;">：当使用javascript控制dom去改变样式的时候，只能使用link标签，因为@import不是dom可以控制的.</span></div></blockquote></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">样式表的优先级</span></h3><div style="margin: 0px 0px 0px 30px; padding: 0px; font-size: medium; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">A、内联样式表的优先级别最高</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">B、内部样式表与外部样式表的优先级和书写的顺序有关，后书写的优先级别高。</span></div></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">CSS选择符（选择器）</span></h3><div style="margin: 0px 0px 0px 30px; padding: 0px; font-size: medium; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">常用的选择符有十种左右</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">类型选择符，id选择符，class选择符，通配符，群组选择符</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;-en-paragraph:true;">包含选择符，伪类选择符(伪类选择符CSS中已经定义好的选择器,不能随便取名)，伪对象选择符(设置在对象后发生的内容。用来和content属性一起使用 )</span></div><div><span style="font-size: 18px; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold; line-height: 40px;">1） 元素选择符/类型选择符（element选择器 )</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div style="margin: 0px; padding: 0px;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">语法：元素名称{属性：属性值；}</span></div><div style="margin: 0px; padding: 0px;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">说明：</span></div><div style="margin: 0px; padding: 0px;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">a)元素选择符就是以文档语言对象类型作为选择符，即使用结构中元素名称作为选择符。例如body、div、p,img,em,strong,span......等。</span></div><div style="margin: 0px; padding: 0px;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">b)所有的页面元素都可以作为选择符;</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">用法：</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">1)如果想改变某个元素得默认样式时，可以使用类型选择符；</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;-en-paragraph:true;">（如：改变一个div、p、h1样式）</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">2) 当统一文档某个元素的显示效果时，可以使用类型选择符</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;-en-paragraph:true;">（如：改变文档所有p段落样式）</span></div></blockquote><div><span style="font-size: 18px; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold; line-height: 40px;">2) id选择器</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">语法：#id名{属性：属性值;}</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">说明：</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">A）当我们使用id选择符时，应该为每个元素定义一个id属性</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">如：&lt;div id=&quot;div1&quot;&gt;&lt;/div&gt;</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">B）id选择符的语法格式是“#”加上自定义的id名</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;-en-paragraph:true;">如：#box{width:300px; height:300px;}</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">C) 起名时要取英文名，不能用关键字：(所有的标记和属性都是关键字)</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">如：head标记</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">D）一个id名称只能对应文档中一个具体的元素对象，因为id只能定义页面中某一个唯一的元素对象。</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;-en-paragraph:true;">E) 最大的用处：创建网页的外围结构。</span></div></blockquote><div><span style="font-size: 18px; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">3）class选择器</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">语法：.class名{属性：属性值;}</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">说明：</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">A）当我们使用class选择符时，应先为每个元素定义一个类名称</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">B）class选择符的语法格式是：&quot;如：&lt;div class=&quot;top&quot;&gt;&lt;/div&gt;&quot;</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">用法：class选择符更适合定义一类样式；</span></div></blockquote><div><span style="font-size: 18px; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">4)*通配符</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">语法：*{属性：属性值；}</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">说明：通配选择符的写法是“*”，其含义就是所有元素。</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">用法：常用来重置样式。</span></div></blockquote><div><span style="font-size: 18px; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">5）群组选择器</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">语法：选择符1，选择符2，选择符3{属性：属性值;}</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">说明：当有多个选择符应用相同的样式时，可以将选择符用“，”分隔的方式，合并为一组。</span></div></blockquote><div><span style="font-size: 18px; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">6） 包含选择器</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">语法：选择符1 选择符2{属性：属性值;}</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">说明：选择符1和选择符2用空格隔开，含义就是选择符1中包含的所有选择符2;</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">用法：当我的元素存在父级元素的时候，我要改变自己本身的样式，可以不另加选择符，直接用包含选择器的方式解决。</span></div></blockquote><div><span style="font-size: 18px; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">7） 伪类选择器(伪类选择符)</span></div><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">语法 ：</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">a:link{属性：属性值;}超链接的初始状态;</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">a:visited{属性：属性值;}超链接被访问后的状态;</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">a:hover{属性：属性值;}鼠标悬停，即鼠标划过超链接时的状态;</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">a:active{属性：属性值;}超链接被激活时的状态，即鼠标按下时超链接的状态;</span></div><div><span style="font-size: 18px; color: red; font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">要让他们遵守一个爱恨原则LoVe/HAte,也就是Link--visited--hover--active。</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">说明：</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">A）当这4个超链接伪类选择符联合使用时，应注意他们的顺序，正常顺序为：</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">a:link,a:visited,a:hover,a:active,错误的顺序有时会使超链接的样式失效；</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">B）为了简化代码，可以把伪类选择符中相同的声明提出来放在a选择符中；</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">例如：a{color:red;} a:hover{color:green;} 表示超链接的三种状态都相同，只有鼠标划过变颜色。 </span></div></blockquote></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">CSS选择符的权重</span></h3><div style="margin: 0px 0px 0px 30px; padding: 0px; font-size: medium; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">css中用四位数字表示权重，权重的表达方式如：0，0，0，0</span></div><ol style="margin: 0px; padding: 0px 0px 0px 40px; color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 242);"><li style="margin: 0px 0px 1em; padding: 0px; list-style: decimal;"><div><span style="font-weight: bold; line-height: 1.5; font-size: 16px; font-family: &quot;Microsoft YaHei&quot;;">第一等：代表内联样式，如: style=””，权值为1000。</span></div></li><li style="margin: 0px 0px 1em; padding: 0px; list-style: decimal;"><div><span style="font-weight: bold; line-height: 1.5; font-size: 16px; font-family: &quot;Microsoft YaHei&quot;;">第二等：代表ID选择器，如：#content，权值为0100。</span></div></li><li style="margin: 0px 0px 1em; padding: 0px; list-style: decimal;"><div><span style="font-weight: bold; line-height: 1.5; font-size: 16px; font-family: &quot;Microsoft YaHei&quot;;">第三等：代表类，伪类和属性选择器，如.content，权值为0010。</span></div></li><li style="margin: 0px 0px 1em; padding: 0px; list-style: decimal;"><div><span style="font-weight: bold; line-height: 1.5; font-size: 16px; font-family: &quot;Microsoft YaHei&quot;;">第四等：代表类型选择器和伪元素选择器，如div p，权值为0001。</span></div></li><li style="margin: 0px 0px 1em; padding: 0px; list-style: decimal;"><div><span style="font-weight: bold; line-height: 1.5; font-size: 16px; font-family: &quot;Microsoft YaHei&quot;;">通配符、子选择器、相邻选择器等的。如*、&gt;、+,权值为0000。</span></div></li><li style="margin: 0px 0px 1em; padding: 0px; list-style: decimal;"><div><span style="font-weight: bold; line-height: 1.5; font-size: 16px; font-family: &quot;Microsoft YaHei&quot;;">继承的样式没有权值。</span></div></li></ol><blockquote style="margin: 10px 0px; padding: 10px; border-width: 1px 1px 1px 6px; border-style: solid; border-image: initial; border-radius: 4px; border-color: rgb(255, 102, 0);"><div style="margin: 0px; padding: 0px;"><span style="font-size: 18px; color: red; font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">* 当不同选择符的样式设置有冲突的时候，高权重选择 符的样式会覆盖低权重选择符的样式。</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">例如：b .demo的权重是1+10=11</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">.demo的权重是10</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;-en-paragraph:true;">所以经常会发生.demo的样式失效</span></div><div><span style="font-size: 18px; color: red; font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">* 相同权重的选择符，样式遵循就近原则：哪个选择符最后定义，就采用哪个选择符样式。</span><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;"> </span><span style="font-size: 18px; color: red; font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">（注意：是css样式中定义该选择符的先后，而不是html中使用先后）</span></div></blockquote><div><br style="margin: 0px; padding: 0px;"/></div></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">浮动属性的简单应用</span></h3><div style="margin: 0px 0px 0px 30px; padding: 0px; font-size: medium; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="margin: 0px; padding: 0px;"><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 40px;">语法：float:none/left/right;</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">float:定义网页中其它文本如何环绕该元素显示 </span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">浮动的目的：就是让竖着的东西横着来 </span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">有三个取值：</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">left:元素活动浮动在文本左面</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">right:元素浮动在右面</span></div><div><span style="font-size: medium; color: rgb(0, 0, 0); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal;">none:默认值，不浮动。</span></div></div><h3 style="margin: 10px 0px; padding: 5px 0px 5px 15px; background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background: rgb(0, 170, 136); font-size: 20px; border-radius: 4px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(255, 252, 244); font-family: 微软雅黑; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">页面中的注释</span></h3><div><span style="color: rgb(4, 77, 34); font-weight: bold;">扩展知识点：</span></div><div>Html注释</div><div>&lt;!-- 我是div的页面注释 --&gt;</div><div>css的注释</div><div>/* 我是css的注释 */</div><div><br/></div></div><div><br/></div></span>
</div></body></html> 